package com.rd.student.jiaji.class4.suyan.zrrd.day15;

//import com.zrrd.day07.Student;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
//        System.out.println(Character.isLetter('a'));
//        System.out.println(Character.isLetter('1'));
//        System.out.println(Character.isLetter('中'));
//        char c='展';
//        if (Character.isUpperCase(c)||Character.isLowerCase(c)){
//            System.out.println("是字符");
//        }else {
//            System.out.println("不是字符");
//        }
        ArrayList arrayList=new ArrayList();
        arrayList.add(1111);
        arrayList.add(11);
        arrayList.add(111l);
        //创建对象 空构造器
        //add方法 添加元素
        //get方法 获取元素
        //szie方法 获取容器大小
        for (int i=0;i<arrayList.size();i++){
            System.out.println(arrayList.get(i));
        }
        System.out.println("--------------");
        //set 修改方法
        //remove 删除元素

        arrayList.set(1,11111);
        arrayList.remove(2);
        for (int i=0;i<arrayList.size();i++){
            System.out.println(arrayList.get(i));
        }






        /*ArrayList str = new ArrayList();
        str.add((byte) 1);
        str.add((int) 2);
        str.add((short) 3);
        str.add((double) 3.44);
        str.add((float) 5.33);
        str.add('a');
        for (int i = 0; i < str.size(); i++) {
            System.out.println(str.get(i));

        }

    }
}
class Student{
    private String name;
    private String major;
    public Student(){
    }
    public Student(String name,String major){
        this.major=major;
        this.name=name;
    }
    public String toString(){
         return name+""+major;
    }

         */
//        创建一个arrayList对象 将基本数据类型都存储进去
//        同时 创建一个类 Student(name,major)  再存储一个对象  toString
//        打印整个容器
//        将 对象修改为新的对象   将布尔类型删除   打印整个容器
        ArrayList a = new ArrayList();
        byte b1 = 1;
        a.add(b1);
        short s2 = 1;
        a.add(s2);
        int i = 1;
        a.add(i);
        long l = 1;
        a.add(l);
        double d = 1.0;
        a.add(d);
        float f = 1.0f;
        a.add(f);
        a.add('a');
        a.add(true);
        Student1 student1 = new Student1("suyan", "zhongjia");
        for (int i1 = 0; i1 < a.size(); i1++) {
            System.out.println(a.get(i1));
        }
        System.out.println("------");
        Student1 student2 = new Student1("lili", "zhongjia");
        a.set(6, student2);
        a.remove(7);


        for (int i1 = 0; i1 < a.size(); i1++) {
            System.out.println(a.get(i1));
        }
    }
    static class Student1 {
        String name;
        String major;

        public Student1() {
        }

        public Student1(String name, String major) {
            this.major = major;
            this.name = name;
        }

        public String toString() {
            return name + "" + major;
        }

    }
}
